package com.itheima.controller;

import com.itheima.common.R;

import com.itheima.entity.vo.setmeal.SetmealDishVo;
import com.itheima.entity.vo.setmeal.SetmealListVo;
import com.itheima.service.SetmealService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author huangzelnag
 * @create 2022-05-12
 */

@RestController
@RequestMapping("setmeal")
public class SetmealController {
    @Autowired
    SetmealService setmealService;

    @GetMapping("list")
    public R getSetmealList(@RequestParam String categoryId,
                            @RequestParam String status
                            ){

       List<SetmealListVo> list = setmealService.getSetmealList(categoryId,status);



        return R.success(list);
    }


    /**
     * 获取菜品详情
     * @param id
     * @return
     */
    @GetMapping("dish/{id}")
    public R getSetmealDish(@PathVariable String id){

        SetmealDishVo setmealDishVo = setmealService.getSetmealDish(id);


        return R.success(setmealDishVo);
    }






}
